package com.glory.cqaospda.viewmodel

import com.glory.cqaospda.model.TaskRepository
import com.glory.mvvmnet.base.BaseViewModel
import com.glory.mvvmnet.entity.CallObserveBean
import com.google.gson.JsonObject

class InspectDetailsItemModel : BaseViewModel() {

    private val repository by lazy { TaskRepository() }

    fun defaultProcessCheck(map: JsonObject){

        launchOnlyResult({
            val processCheckBean =
                repository.defaultProcessCheck(map,"EMS_ProcessCheck")
            defUI.callObserve.value = CallObserveBean(1,processCheckBean)
        })
    }

    fun defaultCheckOrder(map : JsonObject){
        launchOnlyResult({
            repository.defaultCheckOrder(map,"EMS_CheckOrder")
            defUI.callObserve.value = CallObserveBean(2)
        })
    }

    fun defaultGetBaseConfig(){

        val map = JsonObject()
        map.addProperty("GroupID", "reason_code")

        launchOnlyResult({
            val baseConfigBean =
                repository.defaultGetBaseConfig(map,"EMS_GetBaseConfig")
            defUI.callObserve.value = CallObserveBean(1,baseConfigBean)
        })
    }

}